Using "uses"
Kellouche
Algeria
Hi,
I try to use the uses command like this
of course, "source.pas" is in the c:\ target, when compiled i have this message error :
why resolved this error ?
thanks for all.
I try to use the uses command like this
uses 'c:\source.pas';
procedure Memo80OnAfterData(Sender: TfrxComponent);
begin
  Memo80.Text := ExtractxMonthFromDate(Memo80.Value, True, True);
end;
of course, "source.pas" is in the c:\ target, when compiled i have this message error :
, so i have suspected the "souce.pas" but the memo80 is never declared in this file !identified redeclared:"Memo80OnAfterData
why resolved this error ?
thanks for all.
Comments
Mick
PS.
How do you make it that CodeBox doesn't contain too many emply lines?
hi Mick
i have the same error after applicated your proposition !!
i would like an example of the using of "uses" command, is there possible ?
i havent understund your PS (i'am so bad in english
I mean - you do NOT have to compile ExtractxMonthFromDate - you can define it in FR script of your report. If you need to compile your new functions you must do some more work to let FR engine see and accept your user functions like its own (e.g. Format(), VarToStr(), and so on).
So if you apply your source of new function to FR script and it will work then you will NOT have to compile it and get error msg.
Mick
the situation is like this : i have 4 reports, each report have its code page, i would like to call the ExtractMonthFromDate function from an external unit witch i define in "source.pas"
logically i will do this in the header of code page for eatch report
but when i do "F9" i have the message error !!
PS : when i put the function ExtractMonthFromDate in the same page code, the previsualisation is correctly executed.
FR 4 comes with so called report inheritance and this functionality seems to be a solution for having pieces of the same code or layout for several reports kept in ONE template.
If you don't find any solution to have your functions defined once anywhere, then you will have to Copy & Paste this piece of FR script to each report you want to use these functions in [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> But I think that even with these[/img]copied & pasted function your reports will have less lines of script [img]style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> Mick[/img]
i think it accepts because he passed succesful the declaration 'uses c:\source.pas'
for the alternative solution, yes adopte this solution but its not the best method
i regard other ways...
Mick
oki my friend.
thanks.
I see there is NOT Memo80OnAfterData procedure in code page of your report.
And Memo80 has no events.
Mick
exactly, so why i have that message error ?
Hi gpi
conventionaly a pascal unit has this declaration
interface
implementation
in the interface we make the definition of function or procedure and if we want the public variables
in impmentation we defined the function and procedure declared in the interface part
so, i have made my all users functions in a "source.pas" and i would like called them in the page code of an FR3 rerport.
in the "FastReport 3 user manuel " script chapter they said :
perhaps this doest not worked with FR3
I've made some tests both with FR4 (4.10.14) and FR3 (C/S demo 3.15a). And while testing I tried to write as simple as possible script to avoid any complication. My tests have ended with succes - so uses work in general. Maybe it doesn't when script is not so simple.
Have a look at attached files.
Attach small demo project with problem here
no i have not change my report template.
i have attached an example in post #9.
thanks for all.
oki
here is a very very simple project.
look at this articl (part Structure of a script) in the official site of FR
1. There is no Memo10 on a Page. There is Memo1
2. OnAfterPrint event may be too late too change contents of TfrxMemoView
3. There is no replacement instruction to change Memo.Text, like Memo.Text := ReplaceIfBlank(...)
4. Did you have any errors while running (F9) this report?
I attach 2 file - your examples with small lifting:
1. Added box around Memo to be sure that anything was printed
2. Commented part of simple_source.pas (implementation etc)
3. Added begin / end. at the end of file.
[img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Mick[/img]
i think the error was in the interface
i have do the same with the pascal unit watch has an anterface and implementation section but in the script pascal of FR it does not supported
i have remove the interface section and the project will word perfectly
all my thanks to Mick and gpi
I try to do this the file is alredy exists in this post but when executed i have this message error is "BEGIN expected"
can i have an example for how can i call a script file from another PC ?
wait and see